package com.seari.vehbaseF.util;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Utlis {

    public static Map<Integer,String> ListToMap(List<Map<String, Object>> list){

        HashMap<Integer, String> map = new HashMap<>();

        for (Map<String, Object> stringObjectMap : list) {
            for( String keys : stringObjectMap.keySet() ) {
                Integer key = (Integer) stringObjectMap.get("SystemCode");
                String value = (String) stringObjectMap.get("SystemName");
                map.put(key,value);
            }


        }

        return map;
    }

    public static Map<Integer,Integer> TypeListToMap(List<Map<String, Object>> list){

        HashMap<Integer, Integer> map = new HashMap<>();

        for (Map<String, Object> stringObjectMap : list) {
            for( String keys : stringObjectMap.keySet() ) {
                Integer key = (Integer) stringObjectMap.get("ParentCode");
                Integer value = (Integer) stringObjectMap.get("DeviceTypeID");
                map.put(key,value);
            }


        }

        return map;
    }


    public static Map<Integer,Integer> DeviceSystemListToMap(List<Map<String, Object>> list){

        HashMap<Integer, Integer> map = new HashMap<>();

        for (Map<String, Object> stringObjectMap : list) {
            for( String keys : stringObjectMap.keySet() ) {
                Integer key = (Integer) stringObjectMap.get("DeviceTypeID");
                Integer value = (Integer) stringObjectMap.get("SystemCode");
                map.put(key,value);
            }


        }

        return map;
    }





}
